window: Only claim a button=1 press sequence when dragging is about to happen
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 12 Jun 2014 12:15:26 +0000 (14:15 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 12 Jun 2014 12:27:35 +0000 (14:27 +0200)
This way plain clicks can be handled in gtkmain through the usual delivery mechanism,
and get possibly handled too by widgets holding a GTK+ grab. If window dragging is to
be started, the sequence will be claimed (and a grab will happen afterwards), notifying
properly the grabbing widget that event delivery was interrupted.

This makes it possible to dismiss popovers by clicking on window headerbars, while
still making it possible to drag the window with the popover opened.

gtk/gtkwindow.c

index 39d3a68cd9064a9d8e9c6a64de155e66b6ea7aee..f8e71fcc46a45d4eabad7066f767d0739c97a633 100644 (file)
@@ -1454,9 +1454,6 @@ multipress_gesture_pressed_cb (GtkGestureMultiPress *gesture,
 
       break;
     }
-
-  gtk_gesture_set_sequence_state (GTK_GESTURE (gesture),
-                                  sequence, GTK_EVENT_SEQUENCE_CLAIMED);
 }
 
 static void
@@ -1483,6 +1480,8 @@ multipress_gesture_stopped_cb (GtkGestureMultiPress *gesture,
     {
       gdouble x_root, y_root;
 
+      gtk_gesture_set_sequence_state (GTK_GESTURE (gesture),
+                                      sequence, GTK_EVENT_SEQUENCE_CLAIMED);
       gdk_event_get_root_coords (event, &x_root, &y_root);
       gdk_window_begin_move_drag_for_device (gtk_widget_get_window (GTK_WIDGET (window)),
                                              gdk_event_get_device ((GdkEvent*) event),